package com.example.demo.mapper;

import com.example.demo.domain.CommodityEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CommodityMapper {
    @Select("select * from commodity where commodityName=#{name}")
    CommodityEntity findByName(@Param("name") String name);

    @Select("select * from commodity")
    List<CommodityEntity> queryAll();

    @Insert("insert into commodity(id,commodityName,price) values(#{id},#{commodityName},#{price})")
    int insert(@Param("id") long id,@Param("commodityName") String commodityName,@Param("price") float price);
}
